package com.controller;


import com.bean.User;
import com.dao.UserDao;

import com.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


import javax.servlet.http.HttpServletRequest;


/**
 * Created by Ming on 2016/9/9.
 */
@Controller
@RequestMapping("user")
public class UserController {
    @Autowired
    UserService userService;

    @RequestMapping("showUser.do")
    public String showUser(HttpServletRequest request) {
        String id = request.getParameter("id");

        User u = new User();

        u.setId(Long.parseLong(id));
        User user = userService.getUser(u);
        request.setAttribute("user", user);
        return "JSP/index";
    }
}
